﻿<UserControl x:Class="DeltaGroup.WheelOfJeopardy.UI.Screens.NotificationMessage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" HorizontalContentAlignment="Stretch"  Background="Transparent">
    
    <UserControl.Resources>
        <Storyboard x:Key="ShowMessageStory">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="message">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2.0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:3.0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:4.5" Value="0"/>
            </DoubleAnimationUsingKeyFrames>            
        </Storyboard>
    </UserControl.Resources>
    <Canvas>
        
        <ItemsControl ItemsSource="{Binding Path=Messages, BindsDirectlyToSource=True}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Name="message" Text="{Binding}" TextWrapping="Wrap" Style="{StaticResource ResourceKey=Title}" Foreground="Yellow" Opacity="0" Background="#000000">
                            <TextBlock.RenderTransform>
                                <TranslateTransform x:Name="translate"/>
                            </TextBlock.RenderTransform>
                            <TextBlock.Triggers>
                                <EventTrigger RoutedEvent="TextBlock.Loaded">
                                    <BeginStoryboard Storyboard="{StaticResource ShowMessageStory}"/>
                                </EventTrigger>
                            </TextBlock.Triggers>
                    </TextBlock>

                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Canvas>
</UserControl>
